{% extends 'base.html' %}

{% block container %}
<div class="layui-container index">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md8">
            <div class="layui-breadcrumb">
                {% breadcrumb crumbs with title=false %}
                {% for item in crumbs %}
                <a href="{{item.Link}}">{{item.Name}}</a>
                {% endfor %}
                {% endbreadcrumb %}
            </div>
            <div class="layui-card article-detail">
                <div class="layui-card-body">
                    <h1 class="title">{{article.Title}}</h1>
                    <div class="meta">
                        {% if article.Category %}<span><a href="{{getUrl("category", article.Category, 0)}}">{{article.Category.Title}}</a></span>{% endif %}
                        <span>{{stampToDate(article.CreatedTime, "2006-01-02")}}</span>
                        <span>{{article.Views}} 阅读</span>
                    </div>
                    {% articleParams params %}
                    <div class="extra">
                        <table class="layui-table">
                            <colgroup>
                                <col width="100">
                                <col>
                            </colgroup>
                            <tbody>
                            {% for item in params %}
                            <tr>
                                <td>{{item.Name}}</td>
                                <td>
                                    {{item.Value}}
                                </td>
                            </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                    {% endarticleParams %}
                    <div class="article-body">
                        {% articleDetail articleContent with name="Content" %}
                        {{articleContent|safe}}
                    </div>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="article-prev-next">
                        <li>
                            {% prevArticle prev %}
                            上一篇：
                            {% if prev %}
                            <a href="{{prev.Link}}">{{prev.Title}}</a>
                            {% else %}
                            没有了
                            {% endif %}
                            {% endprevArticle %}
                          </li>
                          <li>
                              {% nextArticle next %}
                              下一篇：
                              {% if next %}
                              <a href="{{next.Link}}">{{next.Title}}</a>
                              {% else %}
                              没有了
                              {% endif %}
                              {% endnextArticle %}
                          </li>
                    </div>
                </div>
            </div>
            {% include "partial/comment.html" with itemType="article" itemId=article.Id %}
        </div>

        <div class="layui-col-md4">
            {% include "partial/author.html" %}
            <div class="layui-card">
                <div class="layui-card-header">最新文章</div>
                <div class="layui-card-body">
                    {% articleList popularArticles with type="list" order="id desc" limit="6" %}
                    <ul class="aside-list">
                        {% for item in popularArticles %}
                        <li class="item">
                            <a href="{{item.Link}}" class="link">
                                <h5 class="title">{{item.Title}}</h5>
                                <span class="extra">{{item.Views}}阅读</span>
                            </a>
                        </li>
                        {% empty %}
                        <li class="item empty">
                            无最新文章
                        </li>
                        {% endfor %}
                    </ul>
                    {% endarticleList %}
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">相关文章</div>
                <div class="layui-card-body">
                    {% articleList relationList with type="related" limit="6" %}
                    <ul class="aside-list">
                        {% for item in relationList %}
                        <li class="item">
                            <a href="{{item.Link}}" class="link">
                                <h5 class="title">{{item.Title}}</h5>
                                <span class="extra">{{item.Views}}阅读</span>
                            </a>
                        </li>
                        {% endfor %}
                    </ul>
                    {% endarticleList %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}